package com.ncp.model.biz.cart;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.jsp.jstl.sql.Result;

import com.ncp.model.dao.DB;
import com.ncp.model.dao.DbConnection;
import com.ncp.model.entity.cart.OrderBasicBean;

public class HandlePaymentBiz {
	private DB common = new DB();
	
	//根据订单号取得该订单的数据
	public OrderBasicBean getOrderInfoByOrderID(String orderID){
		OrderBasicBean orderBasicBean =new OrderBasicBean();
		String sql = "select * from ORDERBASIC where OrderID = '"+orderID+"'";
		common.setSql(sql);
		common.setConn(DbConnection.getConnByDataSource());
		List<Object> list=new ArrayList<Object>();
//		list.add(0, orderID);
		common.setList(list);
		Result rs = common.executeQuery();
		for(Map<String,Object> object: rs.getRows()){
			orderBasicBean.setOrderID(orderID);
			orderBasicBean.setUserID(Integer.parseInt(object.get("USERID").toString()));
			orderBasicBean.setOrderTime(object.get("ORDERTIME").toString());
			orderBasicBean.setPaymentType(object.get("PAYMENTTYPE").toString());
			orderBasicBean.setTotalPrice(Float.parseFloat(object.get("TOTALPRICE").toString()));
			orderBasicBean.setOrderStatus(object.get("ORDERSTATUS").toString());
			orderBasicBean.setReceiverID(Integer.parseInt(object.get("RECEIVERID").toString()));
			orderBasicBean.setLogisticsType(object.get("LOGISTICSTYPE").toString());
			orderBasicBean.setLogisticsPayment(object.get("LOGISTICSPAYMENT").toString());
			orderBasicBean.setTradeID(object.get("TRADEID").toString());
			orderBasicBean.setBuyerAccount(object.get("BUYERACCOUNT").toString());
			//orderBasicBean.setConsignmentTime(object.get("CONSIGNMENTTIME").toString());
			orderBasicBean.setExpressID(object.get("EXPRESSID").toString());
		}
		return orderBasicBean;
	}
}
